/*
 * lock.h
 *
 */
#include <sys/types.h>
#include "libdlm.h"

#ifndef REQUEST_H_
#define REQUEST_H_

#include "libdlm.h"

#include <sys/types.h>
typedef	unsigned char byte_t;

typedef struct request {
	char type;
	pid_t pid;
	unsigned short int size;
	resource_id_t id;
	lock_type_t lock_type;
	timeout_t timeout;
    char *path; //wcześniej było char path[0] jakieś zalety?
} request_t;

#define DLMD_TEST_SEQUENCE	'0'
#define DLMD_REQ_REGISTER	'1'
#define DLMD_REQ_LOCK		'2'
#define DLMD_REQ_TRYLOCK	'3'
#define DLMD_REQ_UNLOCK		'4'

void dlmd_register(pid_t pid, char* filename);
void dlmd_lock(pid_t pid, resource_id_t resource, lock_type_t lock, timeout_t timeout);
void dlmd_trylock(pid_t pid, resource_id_t resource, lock_type_t lock);
void dlmd_unlock(pid_t pid, resource_id_t resource);

#endif /* REQUEST_H_ */
